﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------

using GameFramework;
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace Cheng
{
    public class GamefacadeComponent : GameFrameworkComponent
    {

        [ShowInInspector]
        public Dictionary<string, int> enemyDic = new Dictionary<string, int>();

        public bool firstGame = true;
        /// <summary>
        /// 上一个场景
        /// </summary>
        public string previousScene = null;
        /// <summary>
        /// 上一个场景位置
        /// </summary>
        public Vector3 previousPostion;

        //public Tiles[,] mapData;
        //private void Start()
        //{
        //    if (ES3.KeyExists("firstGame"))
        //    {
        //        firstGame = ES3.Load<bool>("firstGame");
        //    }

        //}

        public void InitData()
        {
            //if (enemyDic.Count != 0)
            //{
            //    return;
            //}
            //if (ES3.KeyExists("enemyDic"))
            //{
            //    enemyDic = ES3.Load<Dictionary<string, int>>("enemyDic");
            //    return;
            //}
            //var attribute = GameEntry.DataTable.GetDataTable<UGFExtensions.DRAttribute>();

            //foreach (var item in attribute)
            //{
            //    enemyDic.Add(item.Name, 0);
            //}

        }

        //public void SetMapData(int x,int y,Tiles type)
        //{
        //    mapData[x, y] = type;
        //}

        //public Vector3 SetMapData(Tiles type,Vector3 offset)
        //{
        //    var vec = GetFloorData().GetRandomValue();
        //    mapData[(int)vec.x, (int)vec. y] = type;
        //    return vec + offset;
        //}

        public List<Vector3> GetFloorData()
        {
            List<Vector3> floors = new List<Vector3>();
            //for (int i = 0; i < mapData.GetLength(0); i++)
            //{
            //    for (int j = 0; j < mapData.GetLength(1); j++)
            //    {
            //        if (!(i == 0 || j == 0 || i == mapData.GetLength(0) - 1 || j == mapData.GetLength(1) - 1)&& mapData[i, j]==Tiles.Room)
            //        {
            //            floors.Add(new Vector3(i,j,0));
            //        }
            //    }
            //}

            return floors;
        }
    }
}
